import requests


class Http:
    """http通知"""
    def __init__(self, **kwargs):
        self.url: str = ''
        self.method: str = ''
        if kwargs:
            self.init(**kwargs)

    def init(self, url, method):
        self.url = url
        self.method = method

    def send(self, **kwargs):
        resp = requests.request(url=self.url, method=self.method, **kwargs)
        if resp.status_code != 200:
            raise Exception(resp.text)


client = Http()


if __name__ == '__main__':
    client.init('http://www.baidu.com', method='GET')
    client.send()

